#include <iostream>
#include <vector>
#include <string>

using namespace std;

vector< vector<int> > pascal(int numRows)
{
    std::vector< std::vector<int> > ret;

    if(numRows<1)
      return ret;

  for(int i=0;i<numRows;++i)
  {

    std::vector<int> t(i+1,1);
    ret.push_back(t);
    for(int j=1;j<i;++j) //only when i>1 inter inner loop
    {
      ret[i][j] = ret[i-1][j-1]+ret[i-1][j]; 
    }
  }

  for(int i=0;i<numRows;++i)
  {
    string s((numRows-i),' ');
           cout<< s <<"[" ;
    for(std::vector<int>::iterator iter=ret[i].begin();
        iter!=ret[i].end(); ++iter )
    {
      cout<< *iter<<",";

    }
    cout<<"]"<<endl;
  }

  return ret;
}

int main(int argc,char *argv[])
{
  int numRows=10;  //0,1,5,1000
  
  for(int i=0;i<10;++i)
  {
    pascal(i);
  }

   return 0;


}
